﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WW.NActiveRecord.Attriutes;

namespace WW.NActiveRecord.Tests.Models
{

    [Table(Name = "Products")]
    public class Product : Base<Product>
    {
        private readonly MemberField<int> productID = new MemberField<int>();
        private readonly MemberField<string> productName = new MemberField<string>();
        private readonly MemberField<string> quantityPerUnit = new MemberField<string>();
        private readonly MemberField<decimal?>  unitPrice = new MemberField<decimal?>();
        private readonly MemberField<short?>   unitsInStock= new MemberField<short?>();
        private readonly MemberField<short?>  unitsOnOrder = new MemberField<short?>();
        private readonly MemberField<short?>  reorderLevel = new MemberField<short?>();
        private readonly MemberField<bool>   discontinued= new MemberField<bool>();

        //[BelongsTo(Name = "SupplierID")]?
        private readonly MemberRef<Supplier> supplier = BelongsTo<Supplier>("SupplierID");
        private readonly MemberRef<Category> category = BelongsTo<Category>("CategoryID");
        
        public int ProductID
        {
            get
            {
                return this.productID;
            }
            set
            {
                this.productID.Value = value;
            }
        }
        public string ProductName
        {
            get
            {
                return this.productName;
            }
            set
            {
                this.productName.Value = value;
            }
        }
 
        public string QuantityPerUnit
        {
            get
            {
                return this.quantityPerUnit;
            }
            set
            {
                this.quantityPerUnit.Value = value;
            }
        }
 
        public decimal? UnitPrice
        {
            get
            {
                return this.unitPrice;
            }
            set
            {
                this.unitPrice.Value = value;
            }
        }
         public short? UnitsInStock
        {
            get
            {
                return this.unitsInStock;
            }
            set
            {
                this.unitsInStock.Value = value;
            }
        }
         
        public short? UnitsOnOrder
        {
            get
            {
                return this.unitsOnOrder;
            }
            set
            {
                this.unitsOnOrder.Value = value;
            }
        }
 
        public short? ReorderLevel
        {
            get
            {
                return this.reorderLevel;
            }
            set
            {
                this.reorderLevel.Value = value;
            }
        }
         
        public bool Discontinued
        {
            get
            {
                return this.discontinued;
            }
            set
            {
                this.discontinued.Value = value;
            }
        }
        

        public Supplier Supplier
        {
            get { return supplier.Value; }
        }

        public Category Category {
            get { return category.Value; }
        }

        
    }


    
	
}
